#ifndef YOOHOO_XMPPCORE_MESSAGE_H
#define YOOHOO_XMPPCORE_MESSAGE_H

#include "xmppcore/stanza.h"
#include "xmppcore/xmllangtext.h"
#include "xmppcore/protocolkey.h"

#include <QtCore/QList>
#include <QtCore/QSharedDataPointer>

namespace yoohoo_xmppcore {

class MessageSharedData;

class YOOHOO_XMPPCORE_EXPORT Message : public Stanza {
public:
	enum MessageType {
		MessageTypeNormal,
		MessageTypeChat,
		MessageTypeGroupChat,
		MessageTypeHeadline
	};

	static const ProtocolKey PROTOCOL_KEY;

	Message();
	Message(const Message& other);
	void setSubjects(QList<XmlLangText> subjects);
	QList<XmlLangText>& subjects();
	void setBodies(QList<XmlLangText> bodies);
	QList<XmlLangText>& bodies();
	void setThread(QString thread);
	QString thread() const;
	Stanza::StanzaKind stanzaKind() const;
	Message::MessageType messageType() const;
	void setMessageType(Message::MessageType messageType);

protected:
	virtual void doToXml(XmlWriter* xmlWriter);

protected:
	QSharedDataPointer<MessageSharedData> _md;
};

class MessageSharedData : public QSharedData {
public:
	MessageSharedData();
	MessageSharedData(const MessageSharedData& other);

	QList<XmlLangText> subjects;
	QList<XmlLangText> bodies;
	QString thread;
	Message::MessageType messageType;
};

}

#endif
